<?php

include "connect.php";

print "<link rel='stylesheet' href='style.css' type='text/css'>";

print "<table class='maintables'>";

print "<tr class='headline'><td>Balas</td></tr>";

print "<tr class='maintables'><td>";

if(isset($_POST['submit']))

{

$name=$_POST['name'];

$yourpost=$_POST['yourpost'];

$subject=$_POST['subject'];

$id=$_POST['id'];

if(strlen($name)<1)

{

print "Nama Masih Kosong.";

}

else if(strlen($yourpost)<1)

{

print "Pesan masih Kosong.";

}

else

{

$thedate=date("U");

$displaytime=date("F j, Y, g:i a");



$subject=strip_tags($subject);

$name=strip_tags($name);

$yourpost=strip_tags($yourpost);

$insertpost="INSERT INTO forum_posting(author,title,post,showtime,realtime,lastposter,parentid) values('$name','$subject','$yourpost','$displaytime','$thedate','$name','$id')";

mysql_query($insertpost) or die("Tidak Dapat Memasukkan Postingan");

$updatepost="Update forum_posting set numreplies=numreplies+'1', lastposter='$name',showtime='$displaytime', lastrepliedto='$thedate' where postid='$id'";

mysql_query($updatepost) or die("Tidak Dapat Mengupdate Postingan");

print "Pesan Telah Berhasil, Kembali Ke <A href='message.php?id=$id'>Message</a>.";

}

}

else

{

$id=$_GET['id'];

print "<form action='reply.php' method='post'>";

print "<input type='hidden' name='id' value='$id'>";

print "Nama:<br>";

print "<input type='text' name='name' size='20'><br>";

print "Pesan:<br>";

print "<textarea name='yourpost' rows='5' cols='40'></textarea><br>";

print "<input type='submit' name='submit' value='submit'></form>";
}

print "</td></tr></table>";
?>